import Field from 'winged/utils/wt-model-field'
import gender from 'winged/utils/wt-form-utils'

export default {
	title: '患者列表',
	name: 'patientList',
	tableName: 'patients',
	single: true,
	query: {
		method: 'DRONE',
		url:'evaluation/user_info/get_patient_list',
		extraParams:['user_id','department_id','search_key','sc_status','current_order_status','patient_user_id','bmi_grade'],
		transfer: true,
		pagination: true,
		placeholder: '当前没有患者记录',
		sizeParam:'page_size',
		countParam:'totalNum'
	},
		service_type:[
		{
			current_order_status:10
		},
		{
			current_order_status:11
		},
		{
			current_order_status:12
		},
		{
			current_order_status:13
		},
		{
			current_order_status:-11
		},
		{
			current_order_status:-12
		},
		{
			current_order_status:20
		},
		{
			current_order_status:21
		},
		{
			current_order_status:30
		},
		{
			current_order_status:31
		},
		{
			current_order_status:32
		},
	],
		service_status:[
		{
			sc_status:20
		},
		{
			sc_status:21
		},
		{
			sc_status:22
		}
	],
	bmi_grades:[
		"红色",
		"绿色",
		"黄色",
		"粉色",
		"未分组"
	],
	fields: [
		 {
			label: 'ID',
			type: Field.types.text,
			display: true,
			name: 'patient_id',
			tableName: 'patient_id',			
			minWidth:'50',
		},{
			label: '姓名',
			type: Field.types.text,
			display: true,
			name: 'name',
			formSize: 'mini',
			tableName: 'name',
			minWidth:'80',
			rules: [
				{ type: 'text', required: true, message: '输入您的姓名', trigger: 'blur' },
			]
			
		}, {
			label:"会员等级",
			type:Field.types.text,
			display:true,
			name:'bmi_grade',
			tableName: 'bmi_grade',
			minWidth:'100',
			customDisplayComponent: 'wt-patient-class',
		},{
			label: '身份证',
			type: Field.types.text,
			display: true,
			name: 'idcard',
			tableName: 'idcard',
			minWidth:'180',
			rules: [
				{ type: 'number', required: true, message: '身份证号码', trigger: 'blur' },
			],
			// builder:function(data){
			// 	data[this.tableName] = data[this.tableName]
			// }
		},{
			label: '性别',
			type: Field.types.select,
			display: true,
			summary: true,
			name: 'sex',
			tableName: 'sex',
			minWidth:'50',
			rules: [
				{ type: 'number', required: true, message: '', trigger: 'blur' },
			],
			builder:function(data){
				data[this.tableName] = gender.formatGender(data[this.tableName])
			}
		}, {
			label: '电话',
			type: Field.types.number,
			display: true,
			summary: true,
			name: 'phone',
			tableName: 'phone',
			minWidth:'150',
			rules: [
				{ type: 'number', required: true, message: '请输入您的联系方式', trigger: 'blur' },
			]
		},{
			label: '年龄',
			unit: '岁',
			type: Field.types.number,
			display: true,
			name: 'age',
			tableName: 'age',
			summary: true,
			minWidth:'100',
			readonly: true,
			rules: [
				{ required: true, type:'number', message: '' },
			]
		}, {
			label: '体重',
			type: Field.types.number,
			unit:'KG',
			saveAsJson: true,
			display: true,
			summary: true,
			uploadByComponent: true,
			preSubmit: true,
			name: 'weight',
			tableName: 'weight',
			minWidth:'80',
		}, {
			label: '身高',
			type: Field.types.number,
			unit:'cm',
			saveAsJson: true,
			display: true,
			summary: true,
			uploadByComponent: true,
			preSubmit: true,
			name: 'height',
			tableName: 'height',
			minWidth:'80',
		}, {
			label: '地址',
			type: Field.types.textarea,
			saveAsJson: true,
			display: true,
			summary: true,
			uploadByComponent: true,
			preSubmit: true,
			name: 'address',
			tableName: 'address',
			minWidth:'220',
		}
	]
};